import * as uuid from 'uuid';
export function getBase64(file) {
    return new Promise((resolve, reject) => {
      const reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onload = () => resolve(reader.result);
      reader.onerror = error => reject(error);
    });
  }

export const generatePath = (file) => {
    // 上传文件的路径，使用日期命名文件目录
    let suffixIndex = file.name.lastIndexOf(".")
    //let name = file.name.substring(0, suffixIndex)
    let suffix = file.name.substring(suffixIndex)
    let name = uuid.v4()
    // return `${path}/${moment().format('YYYYMMDD')}/${name}${suffix}`
    return `${name}${suffix}`
}